<template>
    <div class="show_box">
        <div class="show_msg">
            <template v-if="!isDel">
                <p>商品名: <input type="text" v-model="form.name" /></p>
                <p>商品价格: <input type="text" v-model="form.price" /></p>
            </template>
            <p v-else>请问您确定删除吗</p>
            <div>
                <button @click="$emit('cancelBtn')">取消</button>
                <button @click="$emit('okBtn', form)">确定</button>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        isDel: {
            default: false,
        },
    },
    data() {
        return {
            form: {
                name: "",
                price: "",
            },
        };
    },
};
</script>

<style scoped>
.show_box {
    background-color: rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.show_msg {
    width: 300px;
    height: 100px;
    background-color: white;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}
</style>
